package 函数式接口.四大函数式接口;

import java.util.function.Consumer;

public class MyConsumer {

    public static void main(String[] args) {
        method(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        }, "hello");

        method(s -> System.out.println(s), "hello");
    }

    public static void method(Consumer<String> consumer, String str) {
        consumer.accept(str);
    }
}
